package com.hwpt.dto.user;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

import static com.hwpt.constant.ExceptionMessageConstant.*;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserRegisterDTO {

    //非空11位
    @NotBlank(message = PHONE_EMPTY)
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = PHONE_FORMAT_ERROR)
    private String phone;

    //非空6-16位
    @NotBlank(message = PASSWORD_EMPTY)
    @Size(min = 6, message = PASSWORD_LENGTH_ERROR)
    //@Pattern(regexp = "^(?=.*[A-Za-z])(?=.*\\d).+$", message = "密码需包含字母和数字")
    private String password;

    //非空6-16位
    @NotBlank(message = PASSWORD_EMPTY)
    @Size(min = 6, message = PASSWORD_LENGTH_ERROR)
    private String confirmPassword;

}
